<template>
	<view>
		<!-- 确定弹窗 -->
		<uni-popup ref="popup" :type="type" :mask-click="mask" @maskClick="maskClick">
			<view class="popupTipsBox">
				<view class="homePopupBox flex-row">
					<view class="deterTitle">
						{{ deterTitle }}
					</view>

					<view class="deterContent flex-center">
						{{ deterContent }}
					</view>

					<view class="completeBtnBox flex-center">
						<button class="deterClose" :plain="true" @click="onDeterClose" v-if="deterCloseShow">取消</button>
						<button class="completeBtn" :plain="true" @click="onPrefect" v-if="completeBtnShow">
							<view class="lineBox flex">
								<view class="line"></view>
								<view class="line2"></view>
							</view>
							确定
						</button>
					</view>

				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		emits: ["tipsOpen", "tipsClose"],
		props: {
			showTips: {
				type: Boolean,
				default: false
			},
			type: {
				type: String,
				default: "center"
			},
			mask: {
				type: Boolean,
				default: false
			},
			deterTitle: {
				type: String,
				default: "提示"
			},
			deterContent: {
				type: String,
				default: "",
				require: true
			},
			deterCloseShow: {
				type: Boolean,
				default: true
			},
			completeBtnShow: {
				type: Boolean,
				default: true
			},
		},
		data() {
			return {

			}
		},
		watch: {
			showTips(val) {
				if (val) {
					this.open()
				} else {
					this.close();
				}
			}
		},
		methods: {
			maskClick() {
				if (this.mask) {
					this.$refs.popup.close();
					this.$emit("tipsClose", false);
				}

			},
			open() {
				this.$refs.popup.open();
				this.$emit("tipsOpen", true);
			},
			close() {
				this.$refs.popup.close();
				this.$emit("tipsClose", false);
			},
			onDeterClose() {
				this.$emit("onDeterClose");
			},
			onPrefect() {
				this.$emit("onPrefect");
			},
		},
	}
</script>

<style scoped lang="scss">
	.popupTipsBox {
		width: 100%;
		background-color: #FFFFFF;
		border-radius: 16rpx;
		position: relative;

		.homePopupBox {
			width: 597rpx;
			background: #FFFFFF;
			border-radius: 40rpx 40rpx 40rpx 40rpx;
			flex-direction: column;
			padding: 36rpx;


			.deterTitle {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;
			}

			.deterContent {
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				min-height: 180rpx;
				word-break: break-all;
			}

			.completeBtnBox {
				width: 100%;
				.deterClose {
					width: 196rpx;
					height: 60rpx;
					border-radius: 30rpx 30rpx 30rpx 30rpx;
					border: 2rpx solid #F2615F;
					font-size: 24rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #F2615F;
					padding: 0;
					margin: 0 23rpx;
				}
			}


			.completeBtn {
				width: 196rpx;
				height: 60rpx;
				background: #F2615F;
				border-radius: 50rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 33rpx;
				padding: 0;
				margin: 0 23rpx;
				border: none;
				position: relative;

				.lineBox {
					position: absolute;
					top: 8rpx;
					left: 24rpx;

					.line {
						width: 10rpx;
						height: 2rpx;
						background: #FFFFFF;
						border-radius: 2rpx;
					}

					.line2 {
						width: 32rpx;
						height: 2rpx;
						background: #FFFFFF;
						border-radius: 2rpx;
						margin-left: 6rpx;
					}
				}
			}
		}
	}
</style>
